package admin.controller;


import admin.service.CaseService;
import common.model.Case;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/admin/case")
public class CaseController {

    @Autowired
    private CaseService caseService;

    @GetMapping("/cases")
    public ResponseEntity<List<Case>> findCases(@RequestParam(required = false) String lawyerName,
                                                @RequestParam(required = false) String userName,
                                                @RequestParam(required = false) Date date,
                                                @RequestParam(required = false) Boolean completed) {
        return ResponseEntity.ok(caseService.findCases(lawyerName, userName, date, completed));
    }
}